class Overlay
{
  
  public final int HIT_GRAPHIC_FRAMES=50;
  
  public PImage hitGraphic = loadImage("hit_graphic.png");
  public int hitGraphicCount = 0;
  public GameCamera gameCamera;
  
  public Overlay(GameCamera gameCamera)
  {
    this.gameCamera = gameCamera;
  }
  
 
 public void draw()
 {
   perspective();
   camera();
   noLights();
   hint(DISABLE_DEPTH_TEST);
   noStroke();
   rectMode(CENTER);
   ellipseMode(CENTER);
   
   //draw center
   fill(0, 0, 0);
   ellipse(width/2, height/2, 10, 10);
   
   //draw reticle
   if(gameCamera.fov==PI/3){
   fill(255,0,0);
   ellipse(mouseX, mouseY, 20, 20);
   fill(0,0,0);
   ellipse(mouseX, mouseY, 15, 15);
   fill(255,0,0);
   rect(mouseX, mouseY, 2, 35);
   rect(mouseX, mouseY, 35, 2);
   noFill();
   stroke(0);
   strokeWeight(4);
   ellipse(400,300,200,200);
   }
   else 
   {
     fill(255,0,0);
     ellipse(400+(mouseX-400)*4,300+(mouseY-300)*12, 20, 20);
     fill(0,0,0);
     ellipse(400+(mouseX-400)*4, 300+(mouseY-300)*12, 15, 15);
     fill(255,0,0);
     rect(400+(mouseX-400)*4, 300+(mouseY-300)*12, 2, 35);
     rect(400+(mouseX-400)*4, 300+(mouseY-300)*12, 35, 2);
   }
   
   
   if(hitGraphicCount>HIT_GRAPHIC_FRAMES)
   {
     hitGraphicCount=0;
   }
   else if(hitGraphicCount>0)
   {
    for(int i=hitGraphicCount; i<HIT_GRAPHIC_FRAMES; i+=3)
    {
     image(hitGraphic,0,0,800,600); 
    }
    hitGraphicCount++;
  }
   
   hint(ENABLE_DEPTH_TEST);
 } 
}
